<?php

/**
 * OfficialSite filter form base class.
 *
 * @package    iEasy
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormFilterGeneratedTemplate.php 29570 2010-05-21 14:49:47Z Kris.Wallsmith $
 */
abstract class BaseOfficialSiteFormFilter extends BaseFormFilterDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'title'            => new sfWidgetFormFilterInput(),
      'link'             => new sfWidgetFormFilterInput(),
      'snapshot'         => new sfWidgetFormFilterInput(),
      'comment'          => new sfWidgetFormFilterInput(),
      'celebrity_id'     => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Celebrity'), 'add_empty' => true)),
      'company_id'       => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Company'), 'add_empty' => true)),
    ));

    $this->setValidators(array(
      'title'            => new sfValidatorPass(array('required' => false)),
      'link'             => new sfValidatorPass(array('required' => false)),
      'snapshot'         => new sfValidatorPass(array('required' => false)),
      'comment'          => new sfValidatorPass(array('required' => false)),
      'celebrity_id'     => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Celebrity'), 'column' => 'celebrity_id')),
      'company_id'       => new sfValidatorDoctrineChoice(array('required' => false, 'model' => $this->getRelatedModelName('Company'), 'column' => 'company_id')),
    ));

    $this->widgetSchema->setNameFormat('official_site_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'OfficialSite';
  }

  public function getFields()
  {
    return array(
      'official_site_id' => 'Number',
      'title'            => 'Text',
      'link'             => 'Text',
      'snapshot'         => 'Text',
      'comment'          => 'Text',
      'celebrity_id'     => 'ForeignKey',
      'company_id'       => 'ForeignKey',
    );
  }
}
